<template>
  <div class="topiclist">
    <div class="title">
      热门专题
    </div>
    <div class="list">
      <router-link
        v-for="item in topiclistdata"
        :key="item.id"
        tag="div"
        class="list-item"
        :to="'/topicDetail?id=' + item.id"
      >
        <img
          :src="item.cover_image"
          alt=""
        >
        <div class="info">
          <p class="name">
            {{ item.name }}
          </p>
          <p
            class="desc"
            v-html="item.content"
          />
        </div>
      </router-link>
    </div>
    <div class="more">
      <img
        src="../../assets/img/logo2.png"
        alt=""
        @click="toList(shopid)"
      >
    </div>
  </div>
</template>

<script>
export default {
  name: "",
  props: {
    topiclistdata: { // 热门专题接收列表
      type: Array,
      default: function () {
        return [];
      },
    },
    shopid: { // 店铺id接收
      type: String,
      default: '',
    }
  },
  data() {
    return {};
  },
  mounted() {
  },
  methods: {
    // 跳转专题列表
    toList(shopid) {
      console.log('跳转专题列表', shopid)
      this.$router.push({
        path: "/topic",
        query: {
          id: shopid,
        },
      });
    },
  },
};
</script>

<style scoped lang="scss">
.topiclist {
  padding: 0 16.19rem;
  margin-top: 2.19rem;
  display: flex;
  flex-direction: column;

  .title {
    width: 11.25rem;
    height: 3.44rem;
    background: rgba(0, 0, 0, 1);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: rgba(234, 234, 234, 1);
  }

  .list {
    margin-top: 1.25rem;
    display: flex;
    // justify-content: flex-start;
    justify-content: space-between;
    // align-items: center;
    flex-wrap: wrap;

    .list-item {
      display: flex;
      flex-direction: column;
      // height: 27rem;
      // margin-right: 1.13rem;
      width: 41.7rem;
      background: #fff;
      margin-bottom: 1.31rem;
      cursor: pointer;

      &:nth-child(2n) {
        margin-right: 0;
      }

      img {
        width: 100%;
        height: 17rem;
        // object-fit: contain;
        display: block;
      }

      .info {
        display: flex;
        flex-direction: column;
        padding: 2.4rem 1.56rem;

        .name {
          font-size: 1.13rem;
          font-family: Microsoft YaHei;
          font-weight: 400;
          color: rgba(51, 51, 51, 1);
        }

        .desc {
          font-size: 0.88rem;
          font-family: Microsoft YaHei;
          font-weight: 400;
          color: rgba(119, 119, 119, 1);
          line-height: 1.7rem;
          margin-top: 1.38rem;
          text-overflow: -o-ellipsis-lastline;
          overflow: hidden;
          text-overflow: ellipsis;
          display: -webkit-box;
          -webkit-line-clamp: 2;
          line-clamp: 2;
          -webkit-box-orient: vertical;
        }
      }
    }
  }

  // .more {
  //   font-size: 1rem;
  //   font-family: Microsoft YaHei;
  //   font-weight: 400;
  //   color: rgba(102, 102, 102, 1);
  //   line-height: 1.95rem;
  //   text-align: center;
  //   margin: 3.13rem auto;
  //   cursor: pointer;
  // }
  .more {
    height: 2.5rem;
    background: rgba(0, 0, 0, 1);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0 1.44rem;

    img {
      width: 7.38rem;
      cursor: pointer;
    }
  }
}
</style>
